package com.toocms.jinjuhang.ui.mine.management_system.withdraw

import androidx.databinding.ObservableBoolean
import androidx.databinding.ObservableField
import com.toocms.jinjuhang.data.center.BankItemData
import com.toocms.tab.base.ItemViewModel
import com.toocms.tab.binding.command.BindingAction
import com.toocms.tab.binding.command.BindingCommand

class WithdrawAccountItemModel(
    viewModel: WithdrawModel,
    val item: ObservableField<BankItemData>,
    val isSelectedObservableBoolean: ObservableBoolean = ObservableBoolean(false)
) : ItemViewModel<WithdrawModel>(viewModel) {
    val itemClickBindingCommand = BindingCommand<BindingAction>(BindingAction {
        viewModel.selectedBank = item.get()
        viewModel.items.forEach {
            it.isSelectedObservableBoolean.set(this@WithdrawAccountItemModel == it)
        }
    })

}